// datetimebutton.h
#ifndef DATETIMEBUTTON_H
#define DATETIMEBUTTON_H

#include <QDateTimeEdit>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QLabel>
#include <QGroupBox>

class DateTimeButton : public QDateTimeEdit
{
    Q_OBJECT

public:
    explicit DateTimeButton(QWidget *parent = nullptr);

    // 重写 QDateTimeEdit 的虚函数
    QSize sizeHint() const override;
    QSize minimumSizeHint() const override;

public slots:
    // 保留原有的方法
    void setCurrentDateTime() { QDateTimeEdit::setDateTime(QDateTime::currentDateTime()); }

protected:
    // 重写鼠标PressEvent来触发自定义对话框
    void mousePressEvent(QMouseEvent *event) override;
    void paintEvent(QPaintEvent *event) override;

private slots:
    void showDateTimeDialog();

private:
    void createDateTimeDialog();

    bool m_internalUpdate;
};

#endif // DATETIMEBUTTON_H
